//判断一个字符串是不是另外一个字符串旋转而来
//输出1表示是，-1不是
#include<stdio.h>
#include<string.h>
#include<malloc.h>


int judje(char *str1,char *str2)
{
  int len1 = strlen(str1);
  int len2 = strlen(str2);
  if(len1 != len2)
    return -1;
  char *newStr = (char *)malloc(2*len1+1);
  strcpy(newStr,str1);
  strcat(newStr,str1);
  if(strstr(newStr,str2) == NULL)
    return -1;
  else 
    return 1;
}

int main()
{
  char *str1 = "abcd";
  char *str2 = "cdab";
  int res = judje(str1,str2);
  printf("res = %d\n",res);
  return 0;
}
